<style>
    .panel-default {
        border-color: #ddd;
        background-color: #fff;
        border: 1px solid transparent;
        border-radius: 3px;
        -webkit-box-shadow: 0 1px 1px rgb(0 0 0 / 5%);
        box-shadow: 0 1px 1px rgb(0 0 0 / 5%);
        box-sizing: border-box;
    }

    .panel-default .panel-heading {
        position: relative;
        color: #333333;
        background-color: #f5f5f5;
        border-color: #ddd;
        padding: 10px 15px;
        border-bottom: 1px solid transparent;
        border-top-right-radius: 2px;
        border-top-left-radius: 2px;
    }

    .panel-heading .remove {
        /*display: none;*/
        right: 10px;
        top: 10px;
        position: absolute;
        z-index: 2;
        width: 18px;
        height: 18px;
        font-size: 14px;
        line-height: 16px;
        color: #fff;
        text-align: center;
        cursor: pointer;
        background: rgba(0, 0, 0, .3);
        border-radius: 50%;
    }

    .panel-default .row {
        margin: 5px 0;
        box-sizing: border-box;
        display: flex;
        align-items: center;
    }

    .panel-default .row .l {
        display: flex;
        align-items: center;
        width: 350px;
    }

    .panel-default .row .r {
        display: flex;
        align-items: center;
    }

    .l .input-group {
        display: flex;
        align-items: center;
        width: 100%;
    }

    .wanl-specs-tag {
        background-color: #f8f8f8;
        position: relative;
        padding: 6px 10px;
        display: inline-block;
        margin-right: 10px;
        text-align: center;
        border-radius: 2px;
        cursor: pointer;
    }

    .text-info {
        color: #1688f1;
        background: #d9edf7;
    }

    .table-bordered {
        margin-top: 20px;
        border: 1px solid #f4f4f4;
        text-align: center;
        width: 100%;
    }
</style>
<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">

        {if $is_shop == 1}
        <div class="layui-form-item">
            <label class="layui-form-label">所属店铺</label>
            <div class="layui-input-block">
                <select name="shop_id" lay-verify="required">
                    <option value='' selected>请选择所属店铺</option>
                    {foreach $shops as $k=>$v}
                    <option value='{$v.id}' {if $row.shop_id==$v['id']}selected=""{/if}>{$v.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        {/if}
        <div class="layui-form-item">
            <label class="layui-form-label">商品分类</label>
            <div class="layui-input-block">
                <select name="category_id">
                    <option value=''>请选择分类</option>
                    {foreach $cates as $k=>$v}
                    <option value='{$v.id}' {if $row.category_id==$v['id']}selected=""{/if}>{$v.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商品名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" class="layui-input" autocomplete="off" lay-verify="required"
                       placeholder="请输入商品名称" value="{$row.name|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">展示价格</label>
            <div class="layui-input-block">
                <input type="text" name="show_price" class="layui-input" autocomplete="off" lay-verify="required"
                       placeholder="请输入展示价格" value="{$row.show_price|default=''}">
            </div>
        </div>
        <!-- <div class="layui-form-item">
             <label class="layui-form-label">审核状态</label>
             <div class="layui-input-block">
                 <input type="radio" name="status" value="0" title="待审核" {if $row['status']==0}checked=""{/if}>
                 <input type="radio" name="status" value="1" title="审核通过" {if $row['status']==1}checked=""{/if}>
                 <input type="radio" name="status" value="2" title="拒绝"  {if $row['status']==2}checked=""{/if}>
             </div>
         </div>-->
        <!-- <div class="layui-form-item">
             <label class="layui-form-label">所属店铺  0:平台</label>
             <div class="layui-input-block">
                 <input type="text" name="shop_id" class="layui-input" autocomplete="off" lay-verify="required" placeholder="请输入所属店铺  0:平台" value="{$row.shop_id|default=''}">
             </div>
         </div>-->
        <!--<div class="layui-form-item">
            <label class="layui-form-label">所属供应商  0:无</label>
            <div class="layui-input-block">
                <input type="text" name="supplier_id" class="layui-input" autocomplete="off" lay-verify="required" placeholder="请输入所属供应商  0:无" value="{$row.supplier_id|default=''}">
            </div>
        </div>-->
        <div class="layui-form-item">
            <label class="layui-form-label">详情</label>
            <div class="layui-input-block">
                <textarea name="content" rows="20" class="layui-textarea editor" placeholder="请输入详情">{$row.content|raw|default=''}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">规格类型</label>
            <div class="layui-input-block">
                <input type="radio" name="spec_type" value="0" lay-filter="spec_type" title="单规格" {if $row['is_spec']==0}checked=""{/if}>
                <input type="radio" name="spec_type" value="1" lay-filter="spec_type" title="多规格" {if $row['is_spec']==1}checked=""{/if}>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">商品规格</label>
            {if $row['is_spec']==0}
            <div class="layui-input-block" id="specContainer0" style="margin-bottom: 15px;">
                <div class="col-md-12" id="">
                    <table class="table table-bordered">
                        <thead>
                        <tr class="info text-info">
                            <!--<th width="40">图片</th>-->
                            <th width="80">原价</th>
                            <th width="80">现价</th>
                            <th width="80">库存</th>
                            <!-- <th width="80">编码</th>-->
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td><input type="number" data-rule="required" name="original_price"
                                       class="input-sm form-control wanl-market_price layui-input"
                                       value="{$row.specs.original_price}"></td>
                            <td><input type="number" data-rule="required" name="price"
                                       class="input-sm form-control wanl-price layui-input" value="{$row.specs.price}">
                            </td>
                            <td><input type="number" data-rule="required" name="stock"
                                       class="input-sm form-control wanl-stock layui-input" value="{$row.specs.stock}">
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>

            </div>
            {else/}

            <div class="layui-input-block" id="specContainer1">
                <div class="layui-col-xs6">
                    <input type="hidden" name="specs_all">
                    <input type="text" name="sku_json" id="skuJson" class="layui-input" autocomplete="off"
                           placeholder="多个规格用空格隔开" value="">
                </div>
                <button type="button" class="layui-btn layui-btn-normal layui-col-xs3" id="addspec">添加规格</button>
                <br>
                <div class="panel panel-default" style="margin-top: 20px;" id="specDetail"></div>
                <div class="col-md-12" id="specTable"></div>
            </div>
            {/if}
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序值</label>
            <div class="layui-input-block">
                <input type="text" name="sort" class="layui-input" autocomplete="off" lay-verify="required"
                       placeholder="请输入排序字段  从大到小" value="{$row.sort|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商品主图</label>
            <div class="layui-input-block layuimini-upload">
                <input name="img" class="layui-input layui-col-xs6" lay-verify="required" placeholder="请上传商品主图"
                       value="{$row.img|default=''}">
                <div class="layuimini-upload-btn">
                    <span><a class="layui-btn" data-upload="img" data-upload-number="one"
                             data-upload-exts="ico|png|jpg|jpeg"><i class="fa fa-upload"></i> 上传</a></span>
                    <span><a class="layui-btn layui-btn-normal" id="select_logo_image" data-upload-select="img"
                             data-upload-number="one"><i class="fa fa-list"></i> 选择</a></span>
                </div>
            </div>
        </div>
        <!-- <div class="layui-form-item">
             <label class="layui-form-label">销量</label>
             <div class="layui-input-block">
                 <input type="text" name="sales" class="layui-input" autocomplete="off" lay-verify="required" placeholder="请输入销量" value="{$row.sales|default=''}">
             </div>
         </div>-->
        <div class="layui-form-item">
            <label class="layui-form-label">上架状态</label>
            <div class="layui-input-block">
                <input type="radio" name="is_sale" value="0" title="下架" {if $row['is_sale']==0}checked=""{/if}>
                <input type="radio" name="is_sale" value="1" title="上架" {if $row['is_sale']==1}checked=""{/if}>
            </div>
        </div>
        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>

<script>
    {if $row['is_spec'] == 1}
    var specAll1 = {$row.sku_json | raw};
    var specs1 = {$row.specs | raw};
    {/if}
</script>